<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>骡窝窝-道具商店</title>
    <link href="/styles/base.css" rel="stylesheet" type="text/css">
    <link href="/styles/itemshop.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="/js/jquery/jquery.js"></script>
    <script type="text/javascript"
            src="/js/mafengwo/js+jquery-1.8.1.min-js+global+json2-js+M+Module-js+M+M-js+M+Log-js+m.statistics-js+advert+inspector^alw^1563531411.js"></script>
    <style>

    </style>
    <script>
        function hideDiv() {
            $("#check").css("display", "none");
        }

        function hideDivOut() {
            $("#checkOut").css("display", "none");
            if ($("#popup_titleOut").text() == "购买成功!") {
                window.location.reload();
            }
        }

        $(function () {
            $(".daoju_list .buy .btn_buy.disabled").click(function () {
                var id = $(this).data("id");
                $.get("/itemshop/owengood", {id: id}, function (data) {
                    if (data.success) {
                        $("#popup_titleOut").text("您当前已拥有该商品,请到期后才重新购买!")
                    } else {
                        $("#popup_titleOut").text("库存不足,不能订购!")
                    }
                })
                $("#checkOut").css("display", "block");
            })
            var id;
            var price;
            $(".daoju_list .buy .btn_buy.check").click(function () {
                id = $(this).data("id");
                price = $(this).data("price")
                $("#popup_title").text("确定要购买吗?")
                $("#check").css("display", "block");
            })

            $("#popup_ok").click(function () {
                $.get("/itemshop/addCommodity", {id: id, price: price}, function (data) {
                    if (data.success) {
                        $("#popup_titleOut").text("购买成功!")
                    } else {
                        $("#popup_titleOut").text("购买失败!")
                    }
                })
                $("#checkOut").css("display", "block");
            })


            $("._j_goods_tab").click(function () {
                $("._j_goods_tab").removeClass("active");
                $(this).addClass("active");
                var index = $(this).data("index");
                if (index == "0") {
                    $("strong").css("left", "0px");
                    $(".daoju_none").css("display", "none");
                    $(".daoju_none").next("ul:first").css("display", "block");
                    $(".owenGoods").css("display", "none ");
                } else {
                    $("strong").css("left", "180px");
                    if ($("#size").val() == "0") {
                        $(".daoju_none").css("display", "block");
                        $(".daoju_none").next().css("display", "none");
                    }else{
                        $(".daoju_none").next().css("display", "none");
                        $(".owenGoods").css("display", "block");
                    }
                }
            })
        })
    </script>
</head>
<body>
<#assign currentNav="itemshop">
<#include "../common/navbar.ftl">
<div class="container">
    <input id="size" type="hidden" value="${size!0}">
    <!-- banner -->
    <div class="banner">
        <img src="/images/daoju_banner.jpg">
    </div>
    <#--main-->
    <div class="row clearfix">
        <div class="col-main">

            <div class="daoju_tab">
                <a class="active _j_goods_tab" data-index="0">道具商店</a>
                <a class="_j_goods_tab" data-index="1">我的道具</a>
                <strong style="left: 0px"></strong>
            </div>
            <div class="daoju_list clearfix _j_goods_list" data-flag="0" data-total="2">
                <div style="display: none;" class="daoju_none">
                    <img src="http://images.mafengwo.net/images/daoju/none.png" alt="">
                    <p>你还没有购买过任何道具哦~</p>
                </div>
                <ul>
                    <#list list as c>
                        <#assign isOwen=false>
                        <li class="_j_goods_li">
                            <div class="info">
                                <a href="itemshop/itemintroduc" target="_blank">
                                    <img src="${c.coverUrl}" alt="${c.name}">
                                    <div class="name">${c.name}<span>剩余${c.surplus!0}</span></div>
                                    <#--                                    <i class="state1">售完</i>-->
                                </a>
                            </div>
                            <div class="buy">
                                <span><i class="icon_gold"></i>${c.price}</span>
                                <#list owenGood! as o>
                                    <#if o.id == c.id>
                                        <#assign isOwen=true>
                                    </#if>
                                </#list>
                                <#if c.surplus &gt; 0 && !isOwen>
                                    <a class="btn_buy _j_not_buy check" data-price="${c.price}"
                                       data-id="${(c.id)!}">购买</a>
                                <#else>
                                    <a class="btn_buy disabled _j_not_buy checkOut" data-price="${c.price}"
                                       data-id="${(c.id)!}">购买</a>
                                </#if>
                            </div>
                        </li>
                    </#list>
                    <li class="coming_soon">
                        <div class="info">

                        </div>
                    </li>
                </ul>
                <ul class="owenGoods" style="display: none;">
                    <#list owenGood! as c>
                        <li class="_j_goods_li">
                            <div class="info">
                                <a href="itemshop/itemintroduc" target="_blank">
                                    <img src="${c.coverUrl}" alt="${c.name}">
                                    <div class="name">${c.name}</div>
                                </a>
                            </div>
                            <div class="buy">
                            </div>
                        </li>
                    </#list>
                </ul>
            </div>
            <div class="pagin" id="smallpager"></div>

        </div>
        <div class="col-side">
            <div class="side_my">
                <p>你的金币</p>
                <div class="gold"><i></i>${(userInfo.integral)!}</div>
            </div>

            <div class="side_cmt">
                <div class="tit">留言板</div>
                <div class="con">
                    <div id="_j_comment_cnt">

                        <div class="addComment clearfix">
                            <div class="pub">
                                <textarea class="_j_comment_pubarea"></textarea>
                                <input type="button" class="_j_comment_pubbtn" value="发表留言">
                            </div>
                        </div>


                        <div class="commentList _j_comment_list">
                            <ul class="cmt_list">
                                <li class="_j_citem" data-cid="501104" data-username="蓝桉"><a
                                            href="http://www.mafengwo.cn/u/83840932.html" class="photo"><img
                                                src="/images/default.jpg"></a> <a
                                            href="http://www.mafengwo.cn/u/83840932.html" class="user">蓝桉</a> <a
                                            href="http://www.mafengwo.cn/u/83840932.html" class="level">LV.3</a> <a
                                            href="http://www.mafengwo.cn/mall/virtual_goods.php#"
                                            class="_j_reply">回复</a> <span class="date">2019-07-21 09:03</span>
                                    <p>wuihtgskhjgs</p></li>
                                <li class="_j_citem" data-cid="501072" data-username="艺腾"><a
                                            href="http://www.mafengwo.cn/u/31184851.html" class="photo"><img
                                                src="/images/default.jpg"></a> <a
                                            href="http://www.mafengwo.cn/u/31184851.html" class="user">艺腾</a> <a
                                            href="http://www.mafengwo.cn/u/31184851.html" class="level">LV.2</a> <a
                                            href="http://www.mafengwo.cn/mall/virtual_goods.php#"
                                            class="_j_reply">回复</a> <span class="date">2019-07-20 16:46</span>
                                    <p>2222</p></li>
                                <li class="_j_citem" data-cid="501064" data-username="棋"><a
                                            href="http://www.mafengwo.cn/u/94900161.html" class="photo"><img
                                                src="/images/default.jpg"></a> <a
                                            href="http://www.mafengwo.cn/u/94900161.html" class="user">棋</a> <a
                                            href="http://www.mafengwo.cn/u/94900161.html" class="level">LV.2</a> <a
                                            href="http://www.mafengwo.cn/mall/virtual_goods.php#"
                                            class="_j_reply">回复</a> <span class="date">2019-07-20 14:56</span>
                                    <p>回复fan13159101129:大佬牛皮</p></li>
                                <li class="_j_citem" data-cid="501060" data-username="知你心暖."><a
                                            href="http://www.mafengwo.cn/u/42099474.html" class="photo"><img
                                                src="/images/default.jpg"></a> <a
                                            href="http://www.mafengwo.cn/u/42099474.html" class="user">知你心暖.</a> <a
                                            href="http://www.mafengwo.cn/u/42099474.html" class="level">LV.1</a> <a
                                            href="http://www.mafengwo.cn/mall/virtual_goods.php#"
                                            class="_j_reply">回复</a> <span class="date">2019-07-20 14:24</span>
                                    <p>回复艺腾:加油 你是最棒的</p></li>
                                <li class="_j_citem" data-cid="501056" data-username="知你心暖."><a
                                            href="http://www.mafengwo.cn/u/42099474.html" class="photo"><img
                                                src="/images/default.jpg"></a> <a
                                            href="http://www.mafengwo.cn/u/42099474.html" class="user">知你心暖.</a> <a
                                            href="http://www.mafengwo.cn/u/42099474.html" class="level">LV.1</a> <a
                                            href="http://www.mafengwo.cn/mall/virtual_goods.php#"
                                            class="_j_reply">回复</a> <span class="date">2019-07-20 14:23</span>
                                    <p>回复知你心暖.:22</p></li>
                                <li class="_j_citem" data-cid="501052" data-username="知你心暖."><a
                                            href="http://www.mafengwo.cn/u/42099474.html" class="photo"><img
                                                src="/images/default.jpg"></a> <a
                                            href="http://www.mafengwo.cn/u/42099474.html" class="user">知你心暖.</a> <a
                                            href="http://www.mafengwo.cn/u/42099474.html" class="level">LV.1</a> <a
                                            href="http://www.mafengwo.cn/mall/virtual_goods.php#"
                                            class="_j_reply">回复</a> <span class="date">2019-07-20 14:20</span>
                                    <p>111</p></li>
                            </ul>
                        </div>
                        <div class="page _j_comment_pagination">
                            <div class="pagin"><span>1/104</span>
                                <a title="下一页" href="http://www.mafengwo.cn/mall/virtual_goods.php#"
                                   class="btn-right _j_pageitem" data-page="2"></a>
                            </div>
                        </div>
                    </div>

                </div>
            </div>

        </div>
    </div>


</div>
<div id="check" style="display:none;">
    <div id="popup_overlay"
         style="position: fixed; z-index: 999; top: 0px; left: 0px; width: 100%; height: 100%; background: rgb(0, 0, 0); opacity: 0.6;"></div>
    <div id="popup_container" class="popup-box new-popbox"><a class="close-btn" onclick="hideDiv()"
                                                              href="javascript:void(0);"
                                                              id="popup_close"><i></i></a>
        <div class="pop-ico" id="popup_icon"><i class="i1"></i></div>
        <div class="pop-ctn"><p class="hd" id="popup_title"></p>
            <p class="bd" id="popup_message"></p></div>
        <div class="pop-btns" id="popup_btn">
            <a role="button" tabindex="0" onclick="hideDiv()" style="width:210px;float: left;"
               class="popbtn popbtn-submit"
               id="popup_ok">&nbsp;确定&nbsp;</a>
            <a role="button" tabindex="0" onclick="hideDiv()" style="width:209px;float: left;"
               class="popbtn popbtn-submit"
               id="popup_cancel">&nbsp;取消&nbsp;</a>
        </div>
    </div>
</div>
<div id="checkOut" style="display:none;">
    <div id="popup_overlayOut"
         style="position: fixed; z-index: 999; top: 0px; left: 0px; width: 100%; height: 100%; background: rgb(0, 0, 0); opacity: 0.6;"></div>
    <div id="popup_containerOut" class="popup-box new-popbox"><a class="close-btn" onclick="hideDivOut()"
                                                                 href="javascript:void(0);"
                                                                 id="popup_closeOut"><i></i></a>
        <div class="pop-ico" id="popup_icon"><i class="i1"></i></div>
        <div class="pop-ctn"><p class="hd" id="popup_titleOut"></p>
            <p class="bd" id="popup_messageOut"></p></div>
        <div class="pop-btns" id="popup_btnOut">
            <a role="button" tabindex="0" onclick="hideDivOut()" class="popbtn popbtn-submit"
               id="popup_okOut">&nbsp;确定&nbsp;</a>
        </div>
    </div>
</div>
<#include "../common/footer.ftl">
</body>
</html>